package com.lagou;

import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
public class MyMessageListener {

    @RabbitListener(queues = "MyQueue")
    public void onMessage(Channel channel, Message message) {
        System.out.println(channel + ":" + Thread.currentThread().getName() + ":" + new String(message.getBody()));
    }

}
